package com.itheima.web;


import com.itheima.service.UserService;
import com.itheima.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    @Value("${server.port}")
    private String port;

    @RequestMapping("findUserById/{id}")
    public User findUserById(@PathVariable Integer id) throws InterruptedException {
        Thread.sleep(5000);
        User user = userService.findUserById(id);
        user.setNote("生产者端口号："+ port);
        return user;
    }
}
